/**
 * @bussiness {接口API}
 * @author {JC}
 * @date {2022-09-26}
 * **/
'use strict';

module.exports = app => {
  const { router, controller, middleware, io } = app
  const jwt = middleware.jwt(app.config.jwt);
  /**@effect 注册接口**/
  router.post('/register', controller.register.index.register);
  /**@effect 登录接口**/
  router.post('/login', controller.login.index.loginbycellphone);
  router.get('/verify', controller.captcha.index.captcha);
  /**@effect 主页商品接口**/
  router.get('/home/goods', controller.goods.index.homeGoodsList);
  /**@effect 全部商品接口**/
  router.post('/goods', controller.goods.index.allGoodsList);
  /**@effect 商品分类接口**/
  router.post('/goods/classes', controller.goods.index.takeCategoryGoods);
  /**@effect 搜索接口**/
  router.post('/search', controller.search.index.searchSomeList);
  /**@effect 用户接口**/
  router.get('/user', jwt, controller.user.index.takeUserInfo);
  /**@effect 单个商品接口**/
  router.get("/singnal", controller.goods.index.takeGoodsByIdx);
  /**@effect 主页帖子接口**/
  router.get("/home/post", controller.post.index.takePostsHome)
  /**@effect 关注与未关注帖子接口**/
  router.get("/posts", jwt, controller.post.index.takeFocusedPost)
  /**@effect 分类帖子接口**/
  router.get("/posts/cate", jwt, controller.post.index.takePostsCateList)
  /**@effect 收藏帖子接口**/
  router.post("/collection", jwt, controller.collection.index.collectionPosts)
  /**@effect 拿到收藏帖子**/
  router.get("/collectioned", jwt, controller.collection.index.takePostsByUserId)
  /**@effect 拿到单个帖子**/ 

  /**@effect IO**/
  // router.get('/chat', controller.chat.index.takeChatAsIO)
  // io.of('/').route('chat', io.controller.chat.takeChatOneByOne)
  /**@effect tencentCloudApi**/
  router.post("/tencentCloudApi", controller.tencentCloud.index.tencentCloudApi)
};
